//toggle GOODS NAV
function showNav(type) {
    if (!type) {
        return;
    }
    var nav = $api.dom('#u-nav .active');

    $api.removeCls(nav, 'active');
    var thisNav = $api.dom('#u-nav .' + type);
    $api.addCls(thisNav, 'active');
}
function openFrameGroup(frames) {
 var width = api.winWidth;
    var nav = $api.byId('u-nav');
    var navPos = $api.offset(nav);
    var header = $api.byId('userCore');
    var headerPos = $api.offset(header);
    var height = api.winHeight - navPos.h - headerPos.h+25;
    
        api.openFrameGroup({
            name: 'group',
            scrollEnabled: true,
           rect: {
                    x: 0,
                    y: headerPos.h+10,
                    w: width,
                    h: height
                },
            index: 0,
            frames: frames
        }, function (ret, err) {
           var type = ret['name'];
           showNav(type);                
        });
    }
    function getUserDetail(uid){
        api.ajax({
        url: 'http://wap.jqmao.cn/getUserDetail?uid='+uid,
        method: 'get',
        dataType: 'json'
        }, function (ret, err) {
            if (ret) {
                
                var content = $api.byId('user-content');
                var tpl = $api.byId('user-template').text;
                var tempFn = doT.template(tpl);
                $api.html(content, tempFn(ret));
             }else{
                //alert(JSON.stringify(err))
            }
        });
    }
apiready = function(){
headerstatus()
    var uid = api.pageParam.id;
   getUserDetail(uid)
    var aa = [{
        name: 'buy', 
        url: 'buyRecord.html',
        bgColor: '#f2f2f2',
        pageParam: {uid:uid},
        customRefreshHeader: 'UIPullRefresh'
    },{
        name: 'win', 
        url: 'winRecord.html', 
        bgColor: '#f2f2f2',
        pageParam:{uid:uid},
        customRefreshHeader: 'UIPullRefresh'
    },{
        name: 'share', 
        url: 'shareRecord.html', 
        bgColor: '#f2f2f2',
        pageParam:{uid:uid},
        customRefreshHeader: 'UIPullRefresh'
    }]
    

    openFrameGroup(aa)

}
    